<template>
  <view class="index">
    <image src="@/assets/test.jpeg" />
    <view class="center">趣碳生活微信授权登陆</view>
    <AtButton :on-click="authLogin" type="primary">微信授权登陆</AtButton>
  </view>
</template>

<script>
import "./index.less";
import Taro from "@tarojs/taro";
import { AtButton } from "taro-ui-vue";
export default {
  components: { AtButton },
  data() {
    return {
      msg: "Hello world!",
      show: false,
    };
  },
  methods: {
    async authLogin() {
      const res = await Taro.getUserProfile({
        desc: "碳潮要获取的你信息",
      });
      this.$store.commit("SET_USERINFO", res.userInfo);
      console.log(this.$store.state);
    },
  },
};
</script>
